#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QListWidgetItem>
#include <QPushButton>
#include <QGraphicsView>
#include <QPointF>
#include <QTimer>
#include "PowerSourceWidget.h"
#include "LightBulbWidget.h"
#include "SwitchWidget.h"
#include "CircuitSystem.h"
#include "MyGraphicsScene.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void handleComboBoxChange(QComboBox* comboBox, QGraphicsItem* selectedItem, int thickness);
private:
    Ui::MainWindow *ui;
    MyGraphicsScene *scene;

    QString draggingItemType;  // 当前拖动的元件类型
    QListWidgetItem *draggedItem = nullptr; // 当前拖动的图标项
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event)  override;
    void mouseReleaseEvent(QMouseEvent *event)override;
    void paintEvent(QPaintEvent *event) override;
    QDrag *drag;
    PowerSourceWidget *PowerSource;
    LightBulbWidget *LightBulb;
    SwitchWidget *Switch;
    QPointF releasePos;
    //QGraphicsItem *newItem;
    QMimeData *mimeData;
    CircuitSystem *cs;
    QTimer *m_timer;

};
#endif // MAINWINDOW_H
